/*
 * @Description: 
 * @Author: ljy
 * @Date: 2021-12-07 22:02:08
 * @LastEditors: ljy
 * @LastEditTime: 2021-12-13 21:05:26
 */
const pool = require('../pool')

function findAll(fun) {
    pool.myQuery("select * from dts_user", [], (result) => {
        fun(result)
    })
}

function pageQuery(obj, fun) {
    pool.myQuery(`select * from dts_user  where username  like '%${obj.username}%' and mobile like '%${obj.mobile}%'  limit ? offset ?`, [obj.limit, obj.offset], (result) => {
        pool.myQuery(`select * from dts_user  where username  like '%${obj.username}%' and mobile like '%${obj.mobile}%'`, [], (res) => {
            fun({ data: result, total: res.length })
        })
    })
}

module.exports = { findAll, pageQuery }